//
//  NSArray+SJAddition.m
//  D12支付宝初级版本
//
//  Created by 周述坚 on 16/9/16.
//  Copyright © 2016年 周述坚. All rights reserved.
//

#import "NSArray+SJAddition.h"
#import "NSObject+SJAddition.h"

@implementation NSArray (SJAddition)

/*
 从plist 文件中创建指定clsName对象数组
 
 
 */
+ (NSArray *)sj_objectListWithPlistName:(NSString *)plistName andClsName:(NSString *)clsName{
    //获取plistd的url
    NSURL *url = [[NSBundle mainBundle] URLForResource:plistName withExtension:nil];
    //加载plist文件
    NSArray *list = [NSArray arrayWithContentsOfURL:url];
    
    //获取模型对象类
    Class cls = NSClassFromString(clsName);
    
    //保存模型的数组
    NSMutableArray *arrayM = [NSMutableArray array];
    
    for (NSDictionary *dict in list) {
        
        [arrayM addObject:[cls sj_objectWithDict:dict]];
    }
    return arrayM;

}

@end
